﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EFS.RC.SupervisorCentral.Common
{
	public class Sound : EFS.Common.Async.AsyncRoot
	{
		/// <summary>
		/// Play a sound
		/// </summary>
		private Sound()
		{
			BeginAsyncProcess2(Play);
		}

		/// <summary>
		/// Unhandled exception
		/// </summary>
		/// <param name="ex"></param>
		protected override void OnException(System.Exception ex)
		{
			// check
			EFS.Common.Verify.Reference(ex, "ex");

			// log
			EFS.EventLog.Log.LogException(ex, this);
		}

		/// <summary>
		/// Describe this object
		/// </summary>
		/// <returns></returns>
		public override System.String Describe() { return "Play sound"; }

		/// <summary>
		/// Play sound
		/// </summary>
		public static void CheckPlay(
			EFS.RC.SupervisorCentral.Controls.Agents.RibbonItem.eImageType eImageType,
			EFS.RC.SupervisorCentral.Common.Config.Sections.Monitoring.Thresholds.Threshold thresshold)
		{
			if (eImageType == Controls.Agents.RibbonItem.eImageType.Warning)
			{
				new Sound();
			}
		}

		/// <summary>
		/// play sound
		/// </summary>
		private void Play()
		{
			System.Console.Beep(350, 500);
		}
	}
}
